package Impl;

import Bean.BeanClass;

import Service.ClassService;
import org.springframework.stereotype.Service;
import Dao.ClassDao;
import javax.annotation.Resource;
import java.util.ArrayList;

@Service("ClassServiceImpl")
public class ClassServiceImpl implements ClassService {
    @Resource(name="ClassDAO")
    ClassDao classDao;

    @Override
    public BeanClass getClassDetails(int id) throws Exception {
        return classDao.getClassDetails(id);
    }

    @Override
    public ArrayList<BeanClass> getClassesByTeacher(String id) throws Exception {
        return classDao.getClassesByTeacher(id);
    }

    @Override
    public ArrayList<BeanClass> getClasses() throws Exception {
        return classDao.getClasses();
    }

    @Override
    public ArrayList<BeanClass> getClassesByPlace(int id,String type) throws Exception {
        return classDao.getClassesByPlace(id,type);
    }

    @Override
    public ArrayList<BeanClass> getClassesByType(int type) throws Exception {
        return classDao.getClassesByType(type);
    }

    @Override
    public ArrayList<BeanClass> getClassesByKeyword(String keyword) throws Exception {
        return classDao.getClassesByKeyword(keyword);
    }

    @Override
    public void classAdd(String class_name, String class_url, double class_price, int type, int num, String teacher_id, int place_id) throws Exception {
        classDao.classAdd(class_name,class_url,class_price,type,num,teacher_id,place_id);
    }

    @Override
    public void classDelete(int class_id) throws Exception {
        classDao.classDelete(class_id);
    }

    @Override
    public void classUpdate(int class_id, String class_name, String class_url, int num, double class_price,String teacher_id,int place_id) throws Exception {
        classDao.classUpdate(class_id,class_name,class_url,num,class_price,teacher_id,place_id);
    }
}
